package com.gesee.zyspps.adapter;

import com.gesee.zys.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

public class GridViewAdapter extends BaseAdapter
{

    private Context mContext;
    private LayoutInflater mInflater;
    
    public GridViewAdapter(Context context){
        this.mContext = context;
        mInflater = LayoutInflater.from(mContext);
    }
    
    @Override
    public int getCount()
    {
        // TODO Auto-generated method stub
        return 6;
    }

    @Override
    public Object getItem(int position)
    {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public long getItemId(int position)
    {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        // TODO Auto-generated method stub
        ViewHolder viewHolder = null;
        if(convertView == null){
            viewHolder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.item_gridview,null);
            viewHolder.caozuo = (TextView) convertView.findViewById(R.id.caozuo);
            convertView.setTag(viewHolder);
        }else{
            viewHolder = (ViewHolder) convertView.getTag();
        }
        if(position == 0){
            viewHolder.caozuo.setText("添加");
            
        }
        if(position == 1){
            viewHolder.caozuo.setText("修改");
        }
        if(position == 2){
            viewHolder.caozuo.setText("删除");
        }
        if(position == 3){
            viewHolder.caozuo.setText("上移");
        }
        if(position == 4){
            viewHolder.caozuo.setText("下移");
        }
        if(position == 5){
            viewHolder.caozuo.setText("取消");
        }
        return convertView;
    }
    
    static class ViewHolder{
        TextView caozuo;
    }

}
